###########################################################
# Install Qt librarys
###########################################################
QT_LIBS                      = \
                               Qt5Core \
                               Qt5DBus \
                               Qt5DesignerComponents \
                               Qt5Designer \
                               Qt5Gui \
                               Qt5NetworkAuth \
                               Qt5Network \
                               Qt5SerialPort \
                               Qt5Sql \
                               Qt5Svg \
                               Qt5Widgets \
                               Qt5XcbQpa \
                               Qt5Xlsx \
                               Qt5XmlPatterns \
                               Qt5Xml 

QT_PLUGINS_ICONENGINES       = qsvgicon

QT_PLUGINS_IMAGEFORMATS      = \
                               qgif \
                               qicns \
                               qico \ 
                               qjpeg \
                               qsvg \
                               qtga \
                               qtiff \
                               qwbmp \
                               qwebp

win32:QT_PLUGINS_PLATFORMS   = qwindows
unix:QT_PLUGINS_PLATFORMS    = qxcb


qt_lib.path                  = $${CYG_INSTALL_PREFIX}/lib/qt/lib
qt_plugins_iconengines.path  = $${CYG_INSTALL_PREFIX}/lib/qt/plugins/iconengines
qt_plugins_imageformats.path = $${CYG_INSTALL_PREFIX}/lib/qt/plugins/imageformats
qt_plugins_platforms.path    = $${CYG_INSTALL_PREFIX}/lib/qt/plugins/platforms

for(var, QT_LIBS) {
    win32:qt_lib.files                  += $$[QT_INSTALL_BINS]/$${var}$${DEBUG_POSTFIX}.dll
    unix:qt_lib.files                   += $$[QT_INSTALL_LIBS]/lib$${var}.so.5
}

win32 {
	qt_lib.files                        += $$[QT_INSTALL_BINS]/libEGL$${DEBUG_POSTFIX}.dll
	qt_lib.files                        += $$[QT_INSTALL_BINS]/libGLESV2$${DEBUG_POSTFIX}.dll
    equals(CYG_OS, 'mingw') {
	    qt_lib.files                    += $$[QT_INSTALL_BINS]/D3Dcompiler_47.dll
	    qt_lib.files                    += $$[QT_INSTALL_BINS]/libgcc_s_dw2-1.dll
	    qt_lib.files                    += $$[QT_INSTALL_BINS]/libstdc++-6.dll
	    qt_lib.files                    += $$[QT_INSTALL_BINS]/libwinpthread-1.dll
    }
}

for(var, QT_PLUGINS_ICONENGINES) {
    win32:qt_plugins_iconengines.files  += $$[QT_INSTALL_PLUGINS]/iconengines/$${var}$${DEBUG_POSTFIX}.dll
    unix:qt_plugins_iconengines.files   += $$[QT_INSTALL_PLUGINS]/iconengines/lib$${var}.so
}

for(var, QT_PLUGINS_IMAGEFORMATS) {
    win32:qt_plugins_imageformats.files += $$[QT_INSTALL_PLUGINS]/imageformats/$${var}$${DEBUG_POSTFIX}.dll
    unix:qt_plugins_imageformats.files  += $$[QT_INSTALL_PLUGINS]/imageformats/lib$${var}.so
}

for(var, QT_PLUGINS_PLATFORMS) {
    win32:qt_plugins_platforms.files    += $$[QT_INSTALL_PLUGINS]/platforms/$${var}$${DEBUG_POSTFIX}.dll
    unix:qt_plugins_platforms.files     += $$[QT_INSTALL_PLUGINS]/platforms/lib$${var}.so
}

INSTALLS += qt_lib
INSTALLS += qt_plugins_iconengines
INSTALLS += qt_plugins_imageformats
INSTALLS += qt_plugins_platforms

#message(Qt version: $$[QT_VERSION])
#message(Qt is installed in $$[QT_INSTALL_PREFIX])
#message(Qt resources can be found in the following locations:)
#message(Documentation: $$[QT_INSTALL_DOCS])
#message(Header files: $$[QT_INSTALL_HEADERS])
#message(Libraries: $$[QT_INSTALL_LIBS])
#message(Binary files (executables): $$[QT_INSTALL_BINS])
#message(Plugins: $$[QT_INSTALL_PLUGINS])
#message(Data files: $$[QT_INSTALL_DATA])
#message(Translation files: $$[QT_INSTALL_TRANSLATIONS])
#message(Settings: $$[QT_INSTALL_CONFIGURATION])
#message(Examples: $$[QT_INSTALL_EXAMPLES])

